{/include file=$this->header_file /}
<!-- 以上顶部信息不要改-->
<link rel="stylesheet" type="text/css" href="/css/acl.css" />
<div id="acl"> {/include file=$this->location_file /}
<h4>资源及下属操作列表</h4>
  <table width="80%" border="1" align="center">
    {/section name=sec2 loop=$resource/}
    <tr onmouseover="this.style.background='#FFFF66'" onmouseout="this.style.background=''">
            <td >{/$resource[sec2].our_group/}</td>
            <td >{/$resource[sec2].our_zh_name/}</td>
            <td >{/$resource[sec2].our_en_name/}</td>
            <td >{/foreach name=sjf_list_1 key=key11 item=item11 from=$resource[sec2].do/}{/$item11/}<br />
 {//foreach/}</td>

            <td ><a href="/acladmin/resource/do_type/up/key/{/$resource[sec2].our_id/}">修改</a></td>
            <td><a  href="#"onclick="javascript:if  (confirm('确定要删除={/$resource[sec2].our_zh_name/}=吗?')) href='/acladmin/resource/do_type/del/key/{/$resource[sec2].our_id/}';else  return;">删除</a></td>
          </tr>
		      {//section/}
        </table>
  {/if $do_type == 'no'/}
  <Script   language="JavaScript"> 
//根据新的英文名字更新唯一标识输入框
 function up(){
     var zhi = document.getElementById("info_en").value;
	 if (zhi != ''){
		 for (i=1;i<=document.getElementById("count").value;i++){
			 document.getElementById("info_sign_"+i).value = zhi + "_" + document.getElementById("info_sign_"+i).value;
		 }
	 }
 }
//重新输入时清除老的英文输入
  function clear_zhi(){
     var zhii = document.getElementById("info_en").value;
	 
		 for (ii=1;ii<=document.getElementById("count").value;ii++){
			 document.getElementById("info_sign_"+ii).value = document.getElementById("info_sign_"+ii).value.replace(zhii+"_","");
		 }
	 
 }
  //验证表单
      function   check_add()   
      {       
	     var biaoji_add=0;
       if   (form1.info_zh.value == "")   
          {   
              alert("请输入中文描述!");   
              form1.info_zh.focus();   
              return   (false);   
          } 
		  
	   if   ( form1.info_en.value == "")   
          {   
              alert("请输入英文描述!");   
              form1.info_en.focus();   
              return   (false);   
          } 
		   //复选框没有选中的清空唯一标识
		   for (iii=1;iii<=document.getElementById("count").value;iii++){
			 if( document.getElementById("doresource_"+iii).checked != true){
			   
			   document.getElementById("info_sign_"+iii).disabled="disabled";
			   
			 }
			 else{
			 biaoji_add=1;
			 }
		 }
		 if   ( biaoji_add == 0)   
          {   
              alert("请选择操作!");   
                 for (iiij=1;iiij<=document.getElementById("count").value;iiij++){					 		   
					   document.getElementById("info_sign_"+iiij).disabled="";					
				 } 
              return   (false);   
          }
		  document.getElementById('sub').disabled = true;
      } 
</script>
  <form id="form1" name="form1" method="post" action="/acladmin/resource/do_type/add" onsubmit="return check_add();"><br />

    <table width="80%" border="1" align="center" style="background:#FFFFCC;" onmouseover="this.style.background='#FFFF66'" onmouseout="this.style.background='#FFFFCC'">
      <tr>
        <th colspan="3">新增</th>
      </tr>
      <tr>
        <td>英文描述
          <input type="text" name="info_en" id="info_en" onblur="up();" onmousedown="clear_zhi();"/></td>
        <td>中文描述
          <input type="text" name="info_zh" /></td>
        <td> 分类(可选)
          <input type="text" name="info_group" /></td>
      </tr>
      <tr>
        <td colspan="3">下属操作<br />
          {/section name=sec1 loop=$doresource/}
          <input name="doresource[]" type="checkbox" id="doresource_{/$smarty.section.sec1.rownum/}" value="{/$doresource[sec1].oud_id/}"  />
          {/$doresource[sec1].oud_zh_name/}
          唯一标识
          <input type="text" name="info_sign[]" id="info_sign_{/$smarty.section.sec1.rownum/}" value="{/$doresource[sec1].oud_en_name/}"/>
          <br />
          {//section/}
          <input name="count" id="count" type="hidden" value="{/$doresource|@count/}" />
        </td>
      </tr>
      <tr>
        <td colspan="2" align="center"><input type="submit" id="sub" name="Submit" value="提交" style="background:#FF0000;" /></td>
      </tr>
    </table>
  </form>
  {//if/}
  {/if $do_type == 'up'/}
  <Script   language="JavaScript">   
     //根据新的英文名字更新唯一标识输入框
 function up(){
     var zhi = document.getElementById("info_en").value;
	 for (i=1;i<=document.getElementById("count").value;i++){
	     document.getElementById("info_sign_"+i).value = zhi + "_" + document.getElementById("info_sign_"+i).value;
	 }
 }
//重新输入时清除老的英文输入
  function clear_zhi(){
     var zhii = document.getElementById("info_en").value;
	 
	 for (ii=1;ii<=document.getElementById("count").value;ii++){
	     document.getElementById("info_sign_"+ii).value = document.getElementById("info_sign_"+ii).value.replace(zhii+"_","");
	 }
 }
     //验证表单
      function   check_up()   
      {       
	    var biaoji=0;
		 
       if   (form1.info_zh.value == "")   
          {   
              alert("请输入中文描述!");   
              form1.info_zh.focus();   
              return   (false);   
          } 
		  
	   if   ( form1.info_en.value == "")   
          {   
              alert("请输入英文描述!");   
              form1.info_en.focus();   
              return   (false);   
          } 
		  //复选框没有选中的清空唯一标识
		   for (iii=1;iii<=document.getElementById("count").value;iii++){
			 if( document.getElementById("doresource_"+iii).checked != true){			   
			   document.getElementById("info_sign_"+iii).disabled="disabled";			   
			 }else{
			     biaoji = 1;
			 }
		 } 
		 if   ( biaoji == 0)   
          {   
              alert("请选择操作!");   
                 for (iiii=1;iiii<=document.getElementById("count").value;iiii++){					 		   
					   document.getElementById("info_sign_"+iiii).disabled="";					
				 } 
              return   (false);   
          }
		  document.getElementById('sub').disabled = true;
      }  
	   
  </Script>
  <form id="form1" name="form1" method="post" action="/acladmin/resource/do_type/up/key/{/$resource_up.our_id/}" onsubmit="return check_up();">
    <table width="80%" border="1" align="center" style="background:#FFFFCC;" onmouseover="this.style.background='#FFFF66'" onmouseout="this.style.background='#FFFFCC'">
      <tr>
        <th colspan="3">修改 &nbsp;&nbsp;&nbsp;<a href='javascript:location.reload();'>刷新页面</a>&nbsp;&nbsp;&nbsp;<a href='javascript:history.go(-1)'>返回</a></th>
      </tr>
      <tr>
        <td>英文描述
          <input type="text" name="info_en" value="{/$resource_up.our_en_name/}" onblur="up();" onmousedown="clear_zhi();" /></td>
        <td>中文描述
          <input type="text" name="info_zh" value="{/$resource_up.our_zh_name/}" /></td>
        <td> 分类
          <input type="text" name="info_group" value="{/$resource_up.our_group/}" /></td>
      </tr>
      <tr>
        <td colspan="3">下属操作<br />
          {/section name=sec1 loop=$doresource/}
          <input name="doresource[]" onclick="jscript:if (this.checked== true) document.getElementById('info_sign_'+{/$smarty.section.sec1.rownum/}).value=document.getElementById('info_en').value+'_'+document.getElementById('info_sign_'+{/$smarty.section.sec1.rownum/}).value;else document.getElementById('info_sign_'+{/$smarty.section.sec1.rownum/}).value = document.getElementById('info_sign_'+{/$smarty.section.sec1.rownum/}).value.replace(document.getElementById('info_en').value+'_','');" type="checkbox" {/if $doresource[sec1].check=='1'/} checked="checked" {//if/} id="doresource_{/$smarty.section.sec1.rownum/}" value="{/$doresource[sec1].oud_id/}"  />
          {/$doresource[sec1].oud_zh_name/}
          唯一标识
          <input type="text" name="info_sign[]" id="info_sign_{/$smarty.section.sec1.rownum/}" value="{/$doresource[sec1].oud_en_name/}"/>
          <br />
          {//section/}
          <input name="count" id="count" type="hidden" value="{/$doresource|@count/}" />
        </td>
      </tr>
      <tr>
        <td colspan="2" align="center"><input type="submit" id="sub" name="Submit" value="提交" style="background:#FF0000;" /></td>
      </tr>
    </table>
  </form>
  {//if/} </div>
<!-- 以下底部信息不要改-->
{/include file=$this->bottom_file /}